package com.furschina.dao;

import org.springframework.stereotype.Repository;

import cn.wooshai.core.dao.hibernate.GenericHibernateDao;

import com.furschina.model.User;

@Repository
public class UserDao extends GenericHibernateDao<User> {

	public User getUserByEmail(String email) {
		return this.findOne(
				"from User as u where u.email = ? and password is not null",
				true, email);
	}

	public User getByName(String username) {
		return this
				.findOne("from User as u where u.username=?", true, username);
	}

	public User getByEmail(String email) {
		return this.findOne("from User as u where u.email = ?", true, email);
	}

}
